package co.chuangdian.oflauncher.folders.setting;

import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.app.ActionBar.TabListener;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout.LayoutParams;
import cn.onekit.CALLBACK;
import cn.onekit.android.ACTIVITY;
import co.chuangdian.oflauncher.OFActivity;
import co.chuangdian.oflauncher.R;
import uc.WizardBar;

@SuppressWarnings("deprecation")
public class MainUI extends OFActivity  implements ActionBar.TabListener{
	

	Fragment[] steps;
	ImageButton doneButton ;
	int stepIndex = 0;

		@Override
		protected void onCreate(Bundle arg0) {
			super.onCreate(arg0);
			setContentView(R.layout.foldersetting_addfragment);
			
		
	setUpTabs();
			
			AddFolder_Step1 AddFolder_Step1 = new AddFolder_Step1();
			AddFolder_Step2 AddFolder_Step2 = new AddFolder_Step2();
			AddFolder_Step3 AddFolder_Step3 = new AddFolder_Step3();
			AddFolder_Step4 AddFolder_Step4 = new AddFolder_Step4();
	
			steps = new Fragment[] { AddFolder_Step1, AddFolder_Step2, AddFolder_Step3, AddFolder_Step4 };
		}
/*
			ImageButton nextButton = (ImageButton) findViewById(R.id.nextButton);
			nextButton.setOnClickListener(new OnClickListener() {
				public void onClick(View v) {
					goNext(++stepIndex);
				}
			});
		
			 doneButton = (ImageButton) findViewById(R.id.doneButton);
			 doneButton.setOnClickListener(new OnClickListener() {
				public void onClick(View v) {
				
				}
			});
		}

		@Override
		public boolean onKeyDown(int keyCode, KeyEvent event) {
			switch (keyCode) {
			case KeyEvent.KEYCODE_BACK:
				if (stepIndex > 0) {
					goNext(--stepIndex);
					return false;
				}
			default:
				break;
			}
			return super.onKeyDown(keyCode, event);
		}
*/
		
		private void setUpTabs() {
			final ActionBar action  = getActionBar();
			action.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
			action.setTitle("创建文件夹");
			action.addTab(action.newTab().setText("名称").setTabListener(this));
			action.addTab(action.newTab().setText("应用").setTabListener(this));
			action.addTab(action.newTab().setText("封面").setTabListener(this));
			action.addTab(action.newTab().setText("视图").setTabListener(this));
		}

		   class MyTabListener implements TabListener {
		        // 接收每个Tab对应的Fragment，操作
		        private android.app.Fragment fragment;

		        public MyTabListener(android.app.Fragment fragment)
		        {
		            this.fragment = fragment;
		        }
				@Override
				public void onTabSelected(Tab tab, android.app.FragmentTransaction ft) {
					// TODO Auto-generated method stub
				//       ft.replace(R.id.context, fragment, null);
				}
				@Override
				public void onTabUnselected(Tab tab, android.app.FragmentTransaction ft) {
					// TODO Auto-generated method stub
					 ft.remove(fragment);
				}
				@Override
				public void onTabReselected(Tab tab, android.app.FragmentTransaction ft) {
					// TODO Auto-generated method stub
					
				}

		    }

		@Override
		public void onTabSelected(Tab tab, android.app.FragmentTransaction ft) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void onTabUnselected(Tab tab, android.app.FragmentTransaction ft) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void onTabReselected(Tab tab, android.app.FragmentTransaction ft) {
			// TODO Auto-generated method stub
			
		}
}